RequireUIFile("jquery-ui.js"); $GLOBALS["AF"]->RequireUIFile("jquery-ui-nestedsortable.js"); $GLOBALS["AF"]->RequireUIFile("MetadataFieldOrdering.js"); $ToPrint = getTree($Order); # exclude all disabled fields $ToPrint = array_filter($ToPrint, "fieldOrderFilter"); foreach ($ToPrint as $Index => $Item) { if ($Item["Type"] == TYPE_GROUP) { $ToPrint[$Index]["Children"] = array_filter($Item["Children"], "fieldOrderFilter"); } } # print all fields & groups using the tree print "
"; printItems($ToPrint, $Type, $SchemaId, $Order->id(), $GroupIdOffset); print "
"; # output the javascript to wire-in the jquery-ui-nestedsortable print "
"; } function printHiddenInputs(array $Types) { foreach ($Types as $Type) { print ""; } } /** * @param array $Items to print, in tree structure * @param string $Type specifying whether this is the list for display or edit * @param int $SchemaId to print in inputs in getGroupButtons() (delete button) * @param int $OrderId id of order, for printing in getGroupButtons() (delete button) * @param int $GroupIdOffset offset for group IDs so we know they're groups */ function printItems(array $Items, string $Type, int $SchemaId, int $OrderId, int $GroupIdOffset) { print "

"; foreach ($Items as $Info) { $IsGroup = $Info["Type"] == TYPE_GROUP; $ItemId = ($IsGroup ? $Info["Id"] + $GroupIdOffset : $Info["Id"]); # if isn't a group, add class to specify nesting as not allowed # if is a group, then add pb-2 to pad bottom for buttons (which are a bit tall) # if is a group, bold text, then add buttons. print "
- ". "
  ". ($IsGroup ? "" : "").htmlspecialchars($Info["Label"]).($IsGroup ? "" : ""). ($IsGroup ? getGroupButtons($SchemaId, ($ItemId - $GroupIdOffset), $OrderId) : ""). "
  "; # if is group, print children of group in ul inside of this li if ($IsGroup) { printItems($Info["Children"], $Type, $SchemaId, $ItemId, $GroupIdOffset); } print "
"; } print "

"; } /** * Get the rename and delete buttons for MetadataGroup items * put here so printItems() isn't too cluttered * @return string html buttons to print */ function getGroupButtons(int $SchemaId, int $GroupId, int $OrderId) { $GroupId = htmlspecialchars($GroupId); $OrderId = htmlspecialchars($OrderId); return "". "". "rename ". "
"; } /** * Filter callback used to filter fields from display. * @param MetadataField|MetadataFieldGroup $Item item to test for exclusion * @return bool TRUE if the item should be included or FALSE otherwise */ function fieldOrderFilter($Item): bool { $Id = $Item["Id"]; if ($Item["Type"] == TYPE_FIELD) { $Field = new MetadataField($Id); if (!$Field->enabled()) { return false; } } return true; } /** * Print an option list containing metadata schemas. * @param MetadataSchema $SchemaInUse Metadata schema in use. */ function PrintSchemaOptionList(MetadataSchema $SchemaInUse) { $Options = []; # get the metadata schema options foreach (MetadataSchema::GetAllSchemas() as $Schema) { $Options[$Schema->Id()] = $Schema->ResourceName() . " Schema"; } $OptList = new HtmlOptionList("SC", $Options, $SchemaInUse->Id()); $OptList->SubmitOnChange(true); $OptList->PrintHtml(); } # ----- MAIN ----------------------------------------------------------------- $SafeSchemaId = defaulthtmlentities($H_Schema->Id()); ?>
Changes to field and group ordering saved

Tip: drag metadata fields and groups to reorder them.

The Display Order settings control the ordering on the item display page for that schema (e.g. Full Record for Resources), if that page supports it. The Editing Order settings control the order of fields on the Edit Resource pages.

Collection Administrators may also choose to group like metadata fields together, and have them appear in their own box on the Full Record or Edit Resource pages. To group a set of metadata fields together, type the name of the grouping in the Add Group box, select whether the group belongs in the Display Order (on the Full Record) or Edit Order (on the Edit Resources page), and click the ``Add`` button. The name of the group will appear in the list in bold, and fields can be moved into the group. The name given to these groupings will only appear on the Full Record page (Display Order) if the "Show Group Names In Full Record Page" option is checked in System Configuration. However, on the Edit Resources page (Edit Order) the name does display and the set of fields is collapsible.

## Display Order

Group:
Id(), $H_GroupIdOffset ); ?>

## Edit Order

Group:
Id(), $H_GroupIdOffset ); ?>